import { request } from "@/utils/request";

/** MOCK数据 */
export interface GoodsInfo {
  [key: string]: any;
  id: number;
  image?: string;
  name?: string;
  cname?: string;
  mobile?: string;
  email?: string;
  date?: string;
  datetime?: string;
  id_card?: string;
  ip?: string;
  url?: string;
  county?: string;
  csentence?: string;
  boolean?: boolean;
};

/** 获取商品列表 GET /api/goods/list */
export async function getList(params: Record<string, any>) {
  return request<API.PagedList<any>>(`/api/goods/list`, {
    method: "GET",
    params,
  });
}

/** 获取商品详情 GET /api/goods/info */
export async function getDetail(params: Record<string, any>) {
  return request(`/api/goods/info`, {
    method: "GET",
    params,
  });
}

/** 查询商品是否被用户收藏 GET /api/goods/iscollect */
export async function getIsCollect(params: Record<string, any>) {
  return request(`/api/goods/iscollect`, {
    method: "GET",
    params,
  });
}

/** 更新商品收藏状态 POST /api/goods/collect */
export async function updateCollectStatus(data: Record<string, any>) {
  return request(`/api/goods/collect`, {
    method: "POST",
    data,
  });
}

/** 兑换商品 POST /api/goods/exchange */
export async function postExchange(data: Record<string, any>) {
  return request(`/api/goods/exchange`, {
    method: "POST",
    data,
  });
}
